//
//  CellOfPic.m
//  王宇先_12
//
//  Created by wyx on 16/3/24.
//  Copyright © 2016年 Apon. All rights reserved.
//

#import "CellOfPic.h"

@interface CellOfPic ()
@property (nonatomic, retain)UIImageView *imageOfSecond;
@end

@implementation CellOfPic
#pragma mark - dealloc
-(void)dealloc{
    [_imageOfSecond release];
    [super dealloc];
}
#pragma mark - 重写 init
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //创建字控件
        [self createSubView];
        [self layoutSubviews];
    }
    return self;
}
#pragma mark - 创建子控件
- (void)createSubView{
    self.imageOfSecond = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageOfSecond];
    [_imageOfSecond release];
    
}
#pragma mark - override layoutSubviews
- (void)layoutSubviews{
    [super layoutSubviews];
    //设置子控件frame 属性
//    self.imageOfSecond.frame = CGRectMake(5, 5, 85*4/3.0, 85);
//    //summary的度自适应
//    CGFloat heigh = [CellOfPic heightOfCellPic:self.imageOfSecond];
//    
}
- (void)setCellContentValueImage:(UIImageView *)image
{
    [self.contentView addSubview:image];
    image.frame = CGRectMake(5, 5, 365, image.image.size.height * 365 / image.image.size.width);
}
+ (CGFloat)heightOfCellPic:(UIImageView *)image
{
    CGFloat hight = image.image.size.height * 365 / image.image.size.width + 10;
    return hight;
}

#pragma mark - other
- (void)awakeFromNib {
    // Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
